<template>
    <div class="fill wrap">
        <div :class="`articleItem items rls`" v-for="a in datas" :key="a.id">
            <nuxt-link :to="`/newsdetail?id=${a.id}`">
                <img v-lazy="a.dynamic_icon">
                <div class="aTitleText">{{ a.dynamic_title }}</div>
                <div class="aDesctionText">{{ a.dynamic_description }}</div>
            </nuxt-link>
        </div>
    </div>
</template>
<script>
export default {
    props: {
        datas: {
            type: Array,
            value: []
        }
    },
    mounted() {
        // this.animationHandler();
    },
    methods: {
        //列表动画
        animationHandler() {
            let count = 0;
            let timer = setInterval(() => {
                this.datas[count].dynamic_icon = this.datas[count].dynamic_icon.replaceAll('\\', '/');
                this.datas[count].isAni = true;
                console.log(count)
                count++;
                console.log(count)
                if (count >= this.datas.length) {
                    clearInterval(timer);
                }
            }, 100);
        },
    }
}
</script>
<style lang="scss" scoped>
.wrap {
    width: 100%;
    padding: 0 20px;
    /* 瀑布流容器内元素的间隔 */
    column-gap: 30px;
    /* 瀑布容器内排列的列数 */
    column-count: 4;

    .item {
        padding: 10px;
        border: 1px solid #000;
        margin-bottom: 10px;
        /* avoid避免在主体框中插入任何中断（页面，列或区域） */
        break-inside: avoid;
    }

    .hisAni {
        filter: blur(20px);
        transform: scale(0.5);
        opacity: 0;
    }

    .articleItem {
        width: 100%;
        break-inside: avoid;
        background-size: cover !important;
        margin-bottom: 30px;
        border-radius: 30px;
        color: #1C1C1C;
        transition: .5s all ease;

        img {
            width: 100%;
            height: auto;
            transition: .5s all ease;
            border-radius: 20px;

            &:hover {
                transform: scale(1.1);
                z-index: 9999;
                box-shadow: 0 0 20px 10px rgba(83, 83, 83, 0.596);
                cursor: pointer;
                border: 1px solid #ededed;
                transform: perspective(500px) rotateX(20deg);
                transform-origin: bottom;
            }

            &:active {
                transform: perspective(300px) rotateX(30deg);
                transform-origin: bottom;
            }
        }

        .aTitleText {
            font-size: 18px;
            font-weight: bold;
            color: #1C1C1C;
            padding: 10px 0;
        }

        .aDesctionText {
            color: #c7c7c7;
        }
    }
}

@media screen and (min-width:0px) and (max-width:1280px) {
    .wrap {
        width: 100%;
        padding: 0 2rem;
        /* 瀑布流容器内元素的间隔 */
        column-gap: 3rem;
        /* 瀑布容器内排列的列数 */
        column-count: 2;

        .item {
            padding: 1rem;
            border: 1px solid #000;
            margin-bottom: 1rem;
            /* avoid避免在主体框中插入任何中断（页面，列或区域） */
            break-inside: avoid;
        }

        .articleItem {
            width: 100%;
            break-inside: avoid;
            background-size: cover !important;
            margin-bottom: 3rem;
            border-radius: 3rem;
            color: #1C1C1C;
            transition: 1s all ease;

            img {
                width: 100%;
                height: auto;
                transition: 1s all ease;
                border-radius: 2rem;

                &:hover {
                    transform: scale(1.1);
                    z-index: 9999;
                    box-shadow: 0 0 2rem 1rem rgba(83, 83, 83, 0.596);
                    cursor: pointer;
                    border: 1px solid #ededed;
                    transform: perspective(50rem) rotateX(20deg);
                    transform-origin: bottom;
                }

                &:active {
                    transform: perspective(30rem) rotateX(30deg);
                    transform-origin: bottom;
                }
            }

            .aTitleText {
                font-size: 1.8rem;
                font-weight: bold;
                color: #1C1C1C;
                padding: 1rem 0;
                // display: none;
            }

            .aDesctionText {
                color: #c7c7c7;
                display: none;
            }
        }
    }
}</style>